package com.bwie;

import com.github.tobato.fastdfs.FdfsClientConfig;
import org.mybatis.spring.annotation.MapperScan;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.scheduling.annotation.EnableScheduling;

/**
 * @description :
 * @Author QiHainan
 * @Create 2025/6/19 14:03
 * @Version 1.0
 */
@SpringBootApplication
@MapperScan(basePackages = {"com.bwie.mapper"})
@Import(FdfsClientConfig.class)
@EnableScheduling
@EnableFeignClients
public class ShopApplication {
    public static void main(String[] args) {
        SpringApplication.run(ShopApplication.class);
    }

//    /**
//     * 创建RedissionClient对象
//     * 分布式锁
//     * @return
//     */
//    @Bean
//    public RedissonClient redissonClient(){
//        Config config = new Config();
//        config.useSingleServer().setAddress("redis://192.168.80.192:6379");
//        RedissonClient redissonClient = Redisson.create();
//
//        return redissonClient;
//    }

    /**
     * 创建RedissonClient对象
     * 分布式锁
     * @return
     */
    @Bean
    public RedissonClient redissonClient(){
        Config config = new Config();
        config.useSingleServer().setAddress("redis://192.168.80.192:6379");

        RedissonClient redissonClient = Redisson.create();
        return redissonClient;
    }
}
